package me.zhengjie.suli.tasks.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import me.zhengjie.base.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;

@Entity
@Data
@Table(name = "tasks")
public class Tasks extends BaseEntity implements Serializable {
    @Id
    @Column(name = "`id`")
    @ApiModelProperty(value = "ID")
    private String id;

    @Column(name = "`task_code`")
    @ApiModelProperty(value = "任务号")
    private String taskCode;

    @Column(name = "`task_type`")
    @ApiModelProperty(value = "任务类型")
    private Integer taskType;

    @Column(name = "`status`")
    @ApiModelProperty(value = "任务状态")
    private Integer status;

    @Column(name = "`location_from`")
    @ApiModelProperty(value = "起始位置")
    private String locationFrom;

    @Column(name = "`location_to`")
    @ApiModelProperty(value = "目标位置")
    private String locationTo;

    @Column(name = "`traycode`")
    @ApiModelProperty(value = "载具")
    private String trayCode;

    @Column(name = "`start_time`")
    @ApiModelProperty(value = "开始时间")
    private Timestamp startTime;

    @Column(name = "`end_time`")
    @ApiModelProperty(value = "结束时间")
    private Timestamp endTime;

    @Column(name = "`remark`")
    @ApiModelProperty(value = "备注")
    private String remark;

    @Column(name = "`ch_seq`")
    @ApiModelProperty(value = "项目号")
    private String chSeq;

    @Column(name = "`el_no`")
    @ApiModelProperty(value = "物料编码")
    private String elNo;

    @Column(name = "`el_name`")
    @ApiModelProperty(value = "物料名称")
    private String elName;

    @Column(name = "`mt_qty`")
    @ApiModelProperty(value = "任务总数量")
    private BigDecimal mtQty;

    @Column(name = "`el_unit`")
    @ApiModelProperty(value = "单位")
    private String elUnit;

    @Column(name = "`source_code`")
    @ApiModelProperty(value = "源单编码")
    private String sourceCode;

    public void copy(Tasks source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

}
